<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<%@ include file="../common.jsp" %>
    <title>爱一同</title>
    <script type="text/javascript">
	    $(document).ready(function(){
	    	$.formValidator.initConfig({formID:"regForm",submitOnce:true,errorFocus:false,
	    		onSuccess : function(){if(checkProtocal()) return true;},
	    		onError : function(){if(checkProtocal());}});
	    	$("#account").formValidator({onShowText:"请输入用户名",onFocus:"5-20个字符"})
	    		.inputValidator({min:5,max:20,onError:"请输入正确的用户名"})
	    	    .ajaxValidator({url : "account/accountCheck",
	    	    	type : "POST",
		    		data : {type: "account"},
		    		success : function(data){return data == 'N';},
		    		onError : "该用户名已存在，请更换用户名"
	    		}).defaultPassed();
	    	$("#email").formValidator({onFocus:"请输入邮箱，以便找回密码"})
	    		.inputValidator({min:6,max:30,onError:"请输入正确的邮箱"})
	    		.regexValidator({regExp:regexEnum.email,onError:"邮箱格式不正确"})
	    		.ajaxValidator({url : "account/accountCheck",
	    			type : "POST",
		    		data : {type: "email"},
		    		success : function(data){return data == 'N';},
		    		onError : "该邮箱已存在，请更换邮箱地址"
	    		}).defaultPassed();
	    	$("#password").formValidator({onFocus:"5-20个字符"})
	    		.inputValidator({min:5,max:20,onError:"密码必须为5-20个字符"});
	    	$("#password2").formValidator({onFocus:"确认密码"})
	    		.inputValidator({min:5,max:20,onError:"重复密码不正确"})
	    		.compareValidator({desID:"password",operateor:"=",onError:"两次输入的密码不一致"});
	    	
		    $("#agreeProtocol").change(function(){checkProtocal();});
	    });
    	
	    function checkProtocal() {
	    	if($("#agreeProtocol").attr("checked")) {
	    		$("#agreeProtocolTip").removeClass("onError");
	    		$("#agreeProtocolTip").html("");
	    		return true;
	    	} else {
	    		$("#agreeProtocolTip").addClass("onError");
	    		$("#agreeProtocolTip").html("请阅读并同意《爱一同用户注册协议》");
	    		return false;
	    	}
	    }
    </script>
    
</head>
<body>
	<%@ include file="../topbar.jsp" %>
	<div align="center" >
		<div style="width:960px; height: 10px; padding-top: 10px;">
			<p style="text-align: right;margin-right: 10px;">
				我已是会员，
				<a href="login">登录</a>
			</p>
		</div>
		<div style="width:960px; height: 60px; border: 1px solid #EFE0D7;">
			<strong style="float: left;padding: 10px 25px 10px; font-size: 1.2em; font-weight: normal; color: #C00">
				加入爱一同，和爱玩儿的同伴一同享受生活吧！
			</strong>
		</div>
		<div style="width:960px; padding-top: 20px;">
			<ul id="errorlist"></ul>
			<form id="regForm" action="account/accountReg" method="post" class="baseform">
				<div style="width: 710px; height: 400px; float: left;">
					<div style="height: 35px; margin-bottom: 15px;">
						<label class="baselabel">用户名：</label>
						<input id="account" name="account" type="text" size="20" class="baseinput">
						<span id="accountTip" style="width: auto;"></span>
					</div>
					<div style="height: 35px; margin-bottom: 15px;">
						<label class="baselabel">电子邮箱：</label>
						<input id="email" name="email" type="text" size="20" class="baseinput">
						<span id="emailTip" style="width: auto;"></span>
					</div>
					<div style="height: 35px; margin-bottom: 15px;">
						<label class="baselabel">密码：</label>
						<input id="password" name="password" type="password" size="20" class="baseinput">
						<span id="passwordTip" style="width: auto;"></span>
					</div>
					<div style="height: 35px; margin-bottom: 15px;">
						<label class="baselabel">确认密码：</label>
						<input id="password2" name="password2" type="password" size="20" class="baseinput">
						<span id="password2Tip" style="width: auto;"></span>
					</div>
					<div style="height: 35px; margin-bottom: 15px;">
						<label class="baselabel"></label>
						<input type="checkbox" id="agreeProtocol" name="agreeProtocol" style="float: left; margin-left: 3px;">
						<label for="agreeProtocol" style="float: left; color: #666; cursor: pointer;width: 214px;">我看过并同意<a href="#" target="_blank" style="cursor: auto; text-decoration: none;">《爱一同用户注册协议》</a></label>
						<span id="agreeProtocolTip" style="width: auto;"></span>
					</div>
					<div style="height: 52px; margin-bottom: 15px;">
						<label class="baselabel"></label>
						<strong id="subStrong" class="btnstrong btnstrong_enable">
							<input id="subButton" type="submit" class="basebtn btn_enable" value="立即注册">
						</strong>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
</html>